﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Shapes;

namespace ChartingModel.Collections.Series
{
    public class DataSeriesBar : DataSeries
    {
        public static event EventHandler<EventArgs> ColorSelection;


        Style.ChartStyleGridLines _chartStyle;
        public DataSeriesBar(Style.ChartStyleGridLines chartStyle)
        {
            _chartStyle = chartStyle;
            poly = new ObservableCollection<Polygon>();
        }

        private Brush fillColor = Brushes.Black;
        private Brush borderColor = Brushes.Black;
        private double borderThickness = 1.0;
        private double barWidth = 0.8;

        public Brush FillColor
        {
            get { return fillColor; }
            set { fillColor = value;
            OnPropertyChanged("FillColor");
            }
        }

        public Brush BorderColor
        {
            get { return borderColor; }
            set { borderColor = value; }
        }

        public double BorderThickness
        {
            get { return borderThickness; }
            set { borderThickness = value; }
        }

        public double BarWidth
        {
            get { return barWidth; }
            set { barWidth = value; }
        }



        ObservableCollection<Polygon> poly;
        public ObservableCollection<Polygon> Poly
        {
            get { return poly; }
            set
            {
                poly = value;
                OnPropertyChanged("Poly");
            }
        }


        int position = 1;
        public void AddBar(string x, double y)
        {
            LineSeries.Points.Add(new Point(position, y));
            position += 1;
            _chartStyle.XTickLabels.Add(x);
        }


        #region("Public Command Defenitions")
        public ICommand SelectFileCommand
        {
            get
            {
                if (_openFile == null)
                {
                    _openFile = new RelayCommand(p => this.SelectFileExecute());
                }
                return _openFile;
            }
        }

        #endregion
        #region("Commands Private backing")

        private RelayCommand _openFile;

        #endregion

        #region("Commands CanExecute Methods")


        #endregion

        #region("Commands Execute Methods")


        #endregion


        private void SelectFileExecute()
        {
            ColorSelection(this, EventArgs.Empty);
        }
    }
}
